package com.le.tester.book.effectivejava3rdchinese.secondReading.l02;

/**
 * createTime：2024-08-02 14:07
 * description：pizza的实现类，指定酱汁的里外
 */
public class Calzone extends Pizza {

    private final boolean sauceInside;

    public static class Builder extends Pizza.Builder<Builder> {
        private boolean sauceInside = false;

        public Builder sauceInside() {
            sauceInside = true;
            return this;
        }

        //返回实现类的类型，在调用的使用需要强制的转换类型
        @Override
        public Calzone build() {
            return new Calzone(this);
        }

        @Override
        protected Builder self() {
            return this;
        }
    }

    private Calzone(Builder builder) {
        super(builder);
        this.sauceInside = builder.sauceInside;
    }
}
